﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 影片售票系统
{
    public partial class zhuce : Form
    {
        public zhuce()
        {
            InitializeComponent();
        }

        private void zhuce_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string zsxm = this.textBox1.Text.Trim();
            int dianhua = Convert.ToInt32(this.textBox2.Text.Trim());
            string name = this.textBox3.Text.Trim();
            string mima = this.textBox4.Text.Trim();

            if (textBox4.TextLength < 6 || textBox4.TextLength > 16)
            {
                MessageBox.Show("密码不符合标准！", "提示");
                return;
            }
          if (textBox4.Text != textBox5.Text)
              {
                    MessageBox.Show("二次密码不一致，请重新输入！", "提示");
                    textBox4.Text = "";
                    textBox5.Text = "";
                    return;
              }
          string sql = string.Format("insert YH_1(zsxm, dianhua, name, mima) values( '{0}','{1}','{2}','{3}' )  ", zsxm, dianhua, name, mima);
         int rs = common.DBHelper.write(sql);
                //else if(textBox4.Text==textBox5.Text)
                //    {
                //    //执行sql向数据库插入新的注册信息。
                //        string sql1 = " insert YH_1，mima values（" + textBox5.Text.Trim().ToString() + "）";
                //    }
            if (rs > 0)
            {
                MessageBox.Show("恭喜您注册成功");
            }
            else
            {
                MessageBox.Show("注册失败请重新注册....");
            }
        }
    }
}
